package com.hmdz.test;

public class ThreadMethod {
    public synchronized void method1() {
        System.out.println("start method1 sync-");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("end method1 sync-");
    }

    public synchronized void method2() {
        System.out.println("start method2 sync-");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("end method2 sync-");
    }

    public synchronized void method3() {
        System.out.println("start method3 sync-");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("end method3 sync-");
    }
}
